#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve() {
    long double n, c, b = 0;
    cin >> n >> c;
    vector<long double> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        c -= a[i] * a[i];
        b += a[i];
    }
    b *= 4;
    long double ta = 4 * n;
    long double ans = (sqrt(b * b + 4 * ta * c) - b) / (2 * ta);
    cout << (ll)ans << endl;
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}